import 'package:flutter/material.dart';
import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';

class SwiperOne extends StatefulWidget {
  const SwiperOne({Key? key}) : super(key: key);

  @override
  State<SwiperOne> createState() => _SwiperOneState();
}

class _SwiperOneState extends State<SwiperOne> {
  List<Map> imgList=[
    {
      "url":"https://www.itying.com/images/flutter/1.png"
    },
    {
      "url":"https://www.itying.com/images/flutter/2.png"
    },
    {
      "url":"https://www.itying.com/images/flutter/3.png"
    },
     {
      "url":"https://www.itying.com/images/flutter/4.png"
    }
  ];
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar:AppBar(
        title: Text("轮播图案例1"),
      ),
      body: Swiper(
        itemBuilder: (BuildContext context,int index){
          return new Image.network(
            imgList[index]["url"],
            fit:BoxFit.fill,
          );
        },
        itemCount: imgList.length,
        pagination: new SwiperPagination(),
      )
    );
  }
}